package org.dtrd.modules.achievement.entity.bean;

import lombok.Data;
import org.dtrd.config.system.Constant;
import org.dtrd.config.system.Constant.RecordState;

import java.util.Optional;

/**
 * 打开动作
 *
 * @author 萧
 * @date:2021-09-27 2:16 下午
 **/
@Data
public class SignInAction {

    /**
     * 打开记录开始时间 HH:mm
     */
    private String starttime;

    /**
     * 打开记录结束时间 HH:mm
     */
    private String endtime;

    /**
     * 记录类型  {@link org.dtrd.config.system.Constant.RecordType}
     */
    private Integer recordType;

    /**
     * 子类型  ，针对血糖、饮食存在，其余记录类型 默认为0 无子类型
     * {@link org.dtrd.config.system.Constant.SugarRecordType}
     * {@link org.dtrd.config.system.Constant.FoodRecordType}
     */
    private Integer subType = 0;

    /**
     * 打卡记录状态  {@link org.dtrd.config.system.Constant.RecordState}
     */
    private Integer isDone = Constant.RecordState.TO_BE_RECORD.getState();

    /**
     * 对应打卡记录ID  默认未添加时为0
     */
    private Integer dataId = 0;

    private String recordValue;

    private String recordValue2;

    private String recordValue3;

    private String recordDesc;

    private String recordPhoto;

    private String recordTime;

    /**
     * 是否已发送提醒
     * {@link org.dtrd.config.system.Constant.RemindStatus}
     */
    private Integer isRemind = Constant.RemindStatus.TO_BE_REMIND.getStatus();

    /**
     * 是否开启发送
     * {@link org.dtrd.config.system.Constant.SendSwitch}
     */
    private Integer isSend = Constant.SendSwitch.SEND_OPEN.getStatus();

    /**
     * 计算中间过程项
     * {@link  org.dtrd.config.system.Constant.SigninItemPlanStatus}
     */
    private Integer signinItemPlanStatus;

    /**
     * 计算中间过程变量，未打卡或未配置项
     */
    private String signinItemValue;

    public Integer getIsDone() {
        return Optional.ofNullable(isDone).orElse(RecordState.TO_BE_RECORD.getState());
    }

    @Override
    public String toString() {
        return "SignInAction{" +
                "starttime='" + starttime + '\'' +
                ", endtime='" + endtime + '\'' +
                ", recordType=" + recordType +
                ", subType=" + subType +
                '}';
    }
}
